home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 11 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.9 KB  |  53 lines

  1. Newsgroups: comp.std.c
  2. Path: phcoms4.seri.philips.nl!panther!baynes
  3. From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
  4. Subject: Re: Can longjmp modify errno?
  5. Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
  6. Message-ID: <DKJpC1.LvD@ukpsshp1.serigate.philips.nl>
  7. Date: Tue, 2 Jan 1996 08:38:25 GMT
  8. References: <DJEADH.HwC@nntpa.cb.att.com> <30cd018a.13538688@nntp.ix.netcom.com> <1995Dec12.185335.8791@sq.com> <danpop.818847488@rscernix> <1995Dec13.233015.28627@sq.com> <danpop.818964974@rscernix>
  9. Organization: Philips Semiconductors, Southampton, UK
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Dan Pop (danpop@mail.cern.ch) wrote:
  13. : >> However, errno is an lvalue, and the object designated by this lvalue
  14. : >> is definitely accessible.
  15. : >
  16. : >But "the object" may be a different object at a different time.
  17. : >
  18. : Even if it is a different object at a different time, this should be
  19. : transparent to a conforming program.  Consider this example:
  20.  
  21. : #imclude <errno.h>
  22. : #include <stdlib.h>
  23.  
  24. : void blah(int i)
  25. : { 
  26. :     errno = i;
  27. : }
  28.  
  29. : int main(void)
  30. : {
  31. :     int i = 3;
  32. :     blah(i);
  33. :     if (i == errno) return EXIT_SUCCESS;
  34. :     return EXIT_FAILURE;
  35. : }
  36.  
  37. : Is this code allowed to return an unsuccessful termination status to
  38. : the host environment?
  39.  
  40. I would agreee that the intent on ISO C 7.1.4 (as given in Plauger) is
  41. that errno is a single value, however I would say that on a strict
  42. reading that is not assured. Also nothing is said except in footnotes
  43. about  applications setting errno. The mention is in footnote 93 where
  44. it only talkes about setting it to zero, so strictly assigning anything
  45. other than zero could have undefined or implementation specific
  46. behaviour. The wording of this section could be improved.
  47.  
  48. --
  49. Stephen Baynes                              baynes@mulsoc2.serigate.philips.nl
  50. Philips Semiconductors Ltd
  51. Southampton                                 My views are my own.
  52. United Kingdom
  53.